from django.db import models
from modelcluster.fields import ParentalKey
from wagtail.admin.edit_handlers import FieldPanel,InlinePanel,MultiFieldPanel,FieldRowPanel
from wagtail.core.fields import RichTextField
from wagtail.core.models import Page,Orderable
from wagtail.images.edit_handlers import ImageChooserPanel
from wagtail.snippets.models import register_snippet        #Categories
from wagtail.search import index
from modelcluster.models import ClusterableModel

class HomePage(Page):
    intro = models.TextField(max_length=200, blank=True, null=True)
    image = models.ForeignKey(
        'wagtailimages.Image',
        blank=True,
        null=True,
        on_delete=models.DO_NOTHING     #如何页面被删除该怎么处理？不删除
    )

    content_panels = Page.content_panels + [
        FieldPanel('intro'),
        FieldPanel('image'),
    ]

    parent_page_types = []


